package com.desmart.renjiao.xmlparase;

import android.util.Xml;

import org.xmlpull.v1.XmlPullParser;

import java.io.InputStream;

public class EmailXmlUtils {

    public static String readXML(InputStream inputStream) {
        XmlPullParser parser = Xml.newPullParser();
        String str = "";
        try {
            parser.setInput(inputStream, "UTF-8");
            int eventType = parser.getEventType();


            while (eventType != XmlPullParser.END_DOCUMENT) {
                switch (eventType) {
                    case XmlPullParser.START_DOCUMENT:

                        break;
                    case XmlPullParser.START_TAG:
                        String name = parser.getName();
                        if (name.equalsIgnoreCase("unreadReturn")) {
                            str = parser.nextText();
                        }
                        break;
                    case XmlPullParser.END_TAG:
                        break;
                }
                eventType = parser.next();
            }
            inputStream.close();
            return str;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
}
